
<ui:composition 
	xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" 
	template="/template/main.xhtml">

	<ui:define name="body">
		<h:form>
			<p:toolbar>
				<p:toolbarGroup align="left">
					<h:commandButton title="#{messages['button.new']}" value="#{messages['button.new']}"  
							action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}" ajax="false" />

					<p:commandButton title="#{messages['button.delete']}" value="#{messages['button.delete']}" onclick="confirmation.show()"
						type="button" immediate="true" ajax="false" />

					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.alert']}!" severity="alert" widgetVar="confirmation">

						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{enderecoListMB.deleteSelection}"
							actionListener="#{enderecoListMB.clear}" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()"/>
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>
			<p:dataTable id="list" var="bean" value="#{enderecoListMB.resultList}">

				<f:facet name="header">#{messages['endereco.list.table.title']}</f:facet>

				<p:column style="width:3%;">
					<h:selectBooleanCheckbox value="#{enderecoListMB.selection[bean.id]}"></h:selectBooleanCheckbox>
				</p:column>
				
				<p:column style="width:4%;" sortBy="#{bean.id}">
					<f:facet name="header">#{messages['endereco.label.id']}</f:facet>
					<h:outputText value="#{bean.id}" />
				</p:column>
						
				<p:column sortBy="#{bean.cep}">
					<f:facet name="header">#{messages['endereco.label.cep']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.cep}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.logradouro}">
					<f:facet name="header">#{messages['endereco.label.logradouro']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.logradouro}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.numero}">
					<f:facet name="header">#{messages['endereco.label.numero']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.numero}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.bairro}">
					<f:facet name="header">#{messages['endereco.label.bairro']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.bairro}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.complemento}">
					<f:facet name="header">#{messages['endereco.label.complemento']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.complemento}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.text}">
					<f:facet name="header">#{messages['endereco.label.localidade']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.localidade}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.localidade}">
					<f:facet name="header">#{messages['endereco.label.uf']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.uf}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.situacao}">
					<f:facet name="header">#{messages['endereco.label.situacao']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.situacao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.pontoX}">
					<f:facet name="header">#{messages['endereco.label.pontox']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.pontoX}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.pontoY}">
					<f:facet name="header">#{messages['endereco.label.pontoy']}</f:facet>
					<h:commandLink action="#{enderecoListMB.getNextView}" actionListener="#{enderecoListMB.clear}">
						<h:outputText value="#{bean.pontoY}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
			</p:dataTable>
		</h:form>

	</ui:define>
</ui:composition>